import { createSlice } from "@reduxjs/toolkit";

export const PersonSlice = createSlice({
  name: "PersonSlice",
  initialState: {
    personList: [
      {
        id: 1,
        name: "张三",
        code: "234567654323456543",
        state: false,
      },
      {
        id: 2,
        name: "李四",
        code: "6348765468943345642",
        state: false,
      },
    ],
  },
  reducers: {
    SwitchState(state, { payload }) {
      state.personList.find((item)=>item.id === payload.id);
       state.item = !state.item
    },

  },
});

export const { SwitchState } = PersonSlice.actions;

export default PersonSlice.reducer;
